<template>
<div class="color-info-cp box-shadow_2">
    <div class="top">
        <div 
            class="one item"
            :style="{
                backgroundColor:dataInfo.one,
            }">
            <div class="bt-list">
                <Copy
                    :title="dataInfo.one"
                    :content="dataInfo.one">
                </Copy>
                <ThemeBg
                    :background="'background-color:'+dataInfo.one+';'">
                </ThemeBg>
                <ColorPicker
                    v-model="dataInfo.one">
                </ColorPicker>
            </div>
        </div>
        <div class="two item"
            :style="{
                backgroundColor:dataInfo.two,
            }">
            <div class="bt-list">
                <Copy
                    :title="dataInfo.two"
                    :content="dataInfo.two">
                </Copy>
                <ThemeBg
                    :background="'background-color:'+dataInfo.two+';'">
                </ThemeBg>
                <ColorPicker
                    v-model="dataInfo.two">
                </ColorPicker>
            </div>
        </div>
        <div class="three item"
            :style="{
                backgroundColor:dataInfo.three,
            }">
            <div class="bt-list">
                <Copy
                    :title="dataInfo.three"
                    :content="dataInfo.three">
                </Copy>
                <ThemeBg
                    :background="'background-color:'+dataInfo.three+';'">
                </ThemeBg>
                <ColorPicker
                    v-model="dataInfo.three">
                </ColorPicker>
            </div>
        </div>
        <div class="four item"
            :style="{
                backgroundColor:dataInfo.four,
            }">
            <div class="bt-list">
                <Copy
                    :title="dataInfo.four"
                    :content="dataInfo.four">
                </Copy>
                <ThemeBg
                    :background="'background-color:'+dataInfo.four+';'">
                </ThemeBg>
                <ColorPicker
                    v-model="dataInfo.four">
                </ColorPicker>
            </div>
        </div>
        <div class="last-and-next">
            <LastNext
                @onLast="onLast"
                @onNext="onNext"
                :lastState="lastColor!==null"
                :nextState="nextColor!==null">
            </LastNext>
        </div>
    </div>
    <div class="bottom">
        <div class="left">
            <div class="item bt">
                <Like
                    :like_data="{
                        color:dataInfo.id,
                    }"
                    :object_data="{
                        color:dataInfo,
                    }"
                    :like_number="dataInfo.like">
                </Like>
            </div>
            <div class="item bt">
                <LinkBt
                    :link="$route.path">
                </LinkBt>
            </div>
            <div class="item bt">
                <GoCreateColor
                    :color="{
                        one:dataInfo.one,
                        two:dataInfo.two,
                        three:dataInfo.three,
                        four:dataInfo.four,
                    }">
                </GoCreateColor>
            </div>
            <div class="item tag">
                <Tags
                    :tags="dataInfo.tags"
                    :dataType="1">
                </Tags>
            </div>
        </div>
        <div class="right">
            <Date
                :date="dataInfo.init_date">
            </Date>
        </div>
    </div>
</div>
</template>

<script>
//配色详情个体组件
import Like from '@/components/other/Like';
import LinkBt from '@/components/other/Link';
import Date from '@/components/other/Date';
import Tags from '@/components/other/Tags';
import Copy from '@/components/other/Copy';
import LastNext from '@/components/other/LastNext';
import ThemeBg from '@/components/other/ThemeBg';
import ColorPicker from '@/components/other/ColorPicker';
export default {
    components: {
        Like,Date,LinkBt,Tags,
        Copy,LastNext,ThemeBg,
        ColorPicker,
    },
    props:{
        dataInfo:{ //对象数据
            type:Object,
            default:()=>{
                return {};
            },
        },
        lastColor:{ //上一个color
            type:Number,
            default:0,
        },
        nextColor:{
            default:0,
        },
    },
    methods:{
        onLast(){
            if(!this.lastColor) return;
            this.$router.push({
                name:'Color',
                params:{
                    id:this.lastColor,
                },
            }).catch(()=> {
                return;
            });
        },
        onNext(){
            if(!this.nextColor) return;
            this.$router.push({
                name:'Color',
                params:{
                    id:this.nextColor,
                },
            }).catch(()=> {
                return;
            });
        },
    },
}
</script>
<style lang="scss" scoped>
.color-info-cp{
    width: 100%;
    border: none;
    background-color: white;
    padding: 15px;
    box-sizing: border-box;
    border-radius: 5px;
    >.top{
        border-radius: 5px;
        overflow: hidden;
        position: relative;
        >.item{
            width: 100%;
            position: relative;
            transition: all 0.1s;
            >.bt-list{
                display: flex;
                width: fit-content;
                position: absolute;
                bottom: 0;
                left: 0;
                opacity: 0;
                transition: all 0.2s;
                >div{
                    margin-right:5px;
                }
                /deep/.copy{
                    border-radius: 0px 3px 0 0; 
                }
                /deep/.colorPicker{
                    border-radius: 3px;
                }
            }
            &:hover{
                >.bt-list{
                    opacity: 1;
                }
            }
        }
        >.one{
            height: 150px;
        }
        >.two{
            height: 100px;
        }
        >.three{
            height: 70px;
        }
        >.four{
            height: 70px;
        }
        >.last-and-next{
            position: absolute;
            top: 0;
            right: 0;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 10px;
            box-sizing: border-box;
            width: fit-content;
            opacity: 0;
            transition: all 0.2s;
            &:hover{
                opacity: 1;
            }
        }
    }
    >.bottom{
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 15px;
        >.left{
            display: flex;
            flex-direction: row;
            justify-content: flex-start;
            align-items: center;
            >.item{
                margin-right: 15px;
            }
            >.bt{
                /deep/div{
                    padding: 10px 15px;
                }
            }
            >.tag{
                span{
                    font-size: 1.1rem;
                    color: #899bb4;
                    margin-right: 15px;
                    cursor: pointer;
                    transition: all 0.2s;
                    &:hover{
                        color: #535f6e;
                    }
                }
            }
            /deep/.goCreateColor{
                border-radius: 4px;
                transition: all .1s;
                box-sizing: border-box;
                text-align: center;
                color: #3a3a59;
                background-color: #fff;
                line-height: 1.3rem;
                cursor: pointer;
                border: 1px solid #e9f2f9;
                font-size: 1.3rem;
                padding: 10px;
                font-weight: bold;
                transition: all 0.2s;
                &:hover{
                    background-color: #f5fcff;
                }
            }
        }
        >.right{
            /deep/.date{
                font-size: 1.2rem;
                line-height: 1.2rem;
                font-weight: bold;
            }
        }
    }
}
</style>

